package org.jmh.base.listener;

import org.jmh.auth.service.IpermissionScanService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class InitDataListener implements ServletContextListener {
    @Autowired
    private IpermissionScanService scanService;


    @Override
    public void contextInitialized(ServletContextEvent sce) {
        try {
            scanService.scan();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        System.out.println("启动成功");
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        ServletContextListener.super.contextDestroyed(sce);
    }
}
